{if empty($gallery)}
	{foreach $info as $i}
		<div class="photogallery {if $iterator->getCounter() % 4 == 0} last{/if}">
			<a href="{plink Photogallery: 'id'=>$id, 'seo_title'=>$i["seo_title"]}"><img src="upload/{$i["main"]["path"]}{$i["main"]["th_name"]}" /></a>
		<h3>
			<a href="{plink Photogallery: 'id'=>$id, 'seo_title'=>$i["seo_title"]}">{$i["title"]}</a>
		</h3>
		<span class="bottom-bg"></span>
    </div>
    {if $iterator->getCounter() % 4 == 0}
				<span class="clear-b"></span>
			{/if}

	{/foreach}
{else}
	
	<h2>
		{$gallery["title"]}
	</h2>
	
	<p>
		{$gallery["text"]}
	</p>
	
	<div>
		{foreach $gallery["pictures"] as $p}
			<div class="photogallery-item {if $iterator->getCounter() % 4 == 0} last{/if}">
				<a class="lightbox" href="upload/{$p["path"]}{$p["name"]}">
					<img src="upload/{$p["path"]}{$p["th_name"]}" />
				</a>
				{if !empty($p["title"])}<strong>{$p["title"]}</strong>{/if}
				<span class="bottom-bg"></span>
			</div>
			
			{if $iterator->getCounter() % 4 == 0}
				<span class="clear-b"></span>
			{/if}
		{/foreach}
	</div>
	
	<div id="fb-root"><script src="http://connect.facebook.net/cs_CZ/all.js#xfbml=1"></script><fb:comments href="{plink Photogallery: 'id'=>$id,'seo_title'=>$gallery["title_seo"]}" num_posts="10" width="938"></fb:comments></div>
	
{/if}

<script type="text/javascript">
$('a.lightbox').lightBox();
</script>